<table>
    <thead>
        <tr>
            <g:sortableColumn property="id" title="Id" titleKey="snapshot.creditControl.id" />
            <th><g:message code="snapshot.creditControl.dealer" default="Dealer" /></th>
            <g:sortableColumn property="orderAmount" title="Order Amount" titleKey="snapshot.creditControl.orderAmount" />
            <g:sortableColumn property="openingSell" title="Opening Sell" titleKey="snapshot.creditControl.openingSell" />
            <g:sortableColumn property="receivableAmout" title="Receivable Amout" titleKey="snapshot.creditControl.receivableAmout" />
            <g:sortableColumn property="receivableNote" title="Receivable Note" titleKey="snapshot.creditControl.receivableNote" />

            <g:sortableColumn property="receivable" title="Receivable" titleKey="snapshot.creditControl.receivable" />
            <g:sortableColumn property="credit" title="Credit" titleKey="snapshot.creditControl.credit" />
            <g:sortableColumn property="creditExceed" title="Credit Exceed" titleKey="snapshot.creditControl.creditExceed" />
            <g:sortableColumn property="creditBalance" title="Credit Balance" titleKey="snapshot.creditControl.creditBalance" />
            
            <g:sortableColumn property="owner" title="Owner" titleKey="snapshot.creditControl.owner" />
            <g:sortableColumn property="createdBy" title="Created By" titleKey="snapshot.creditControl.createdBy" />
            <g:sortableColumn property="lastModifiedBy" title="Last Updated By" titleKey="snapshot.creditControl.lastModifiedBy" />
        </tr>
    </thead>
    <tbody>
    <g:each in="${creditControlInstanceList}" status="i" var="creditControlInstance">
        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
            <td><g:link action="show" id="${creditControlInstance.id}">${fieldValue(bean: creditControlInstance, field: "id")}</g:link></td>
            <td>${fieldValue(bean: creditControlInstance, field: "dealer")}</td>
            <td><g:formatNumber number="${creditControlInstance.orderAmount}" /></td>
            <td><g:formatNumber number="${creditControlInstance.openingSell}" /></td>
            <td><g:formatNumber number="${creditControlInstance.receivableAmout}" /></td>
            <td><g:formatNumber number="${creditControlInstance.receivableNote}" /></td>

            <td><g:formatNumber number="${creditControlInstance.receivable}" /></td>
            <td><g:formatNumber number="${creditControlInstance.credit}" /></td>
            <td><g:formatNumber number="${creditControlInstance.creditExceed}" /></td>
            <td><g:formatNumber number="${creditControlInstance.creditBalance}" /></td>

            <td>
                <g:link controller="user" action="show" id="${creditControlInstance?.owner?.id}">${creditControlInstance?.owner?.encodeAsHTML()}</g:link>
            </td>
            <td>
                <g:link controller="user" action="show" id="${creditControlInstance?.createdBy?.id}">${creditControlInstance?.createdBy?.encodeAsHTML()}</g:link>
                , <g:formatDate date="${creditControlInstance?.dateCreated}" />
            </td>
            <td>
                <g:link controller="user" action="show" id="${creditControlInstance?.lastModifiedBy?.id}">${creditControlInstance?.lastModifiedBy?.encodeAsHTML()}</g:link>
                , <g:formatDate date="${creditControlInstance?.lastUpdated}" />
            </td>
        </tr>
    </g:each>
    </tbody>
</table>
